package com.heima.admin.controller;

import com.heima.admin.annotation.LogModule;
import com.heima.api.wemedia.IWmChannelClient;
import com.heima.model.common.dtos.ResponseResult;

import com.heima.model.wemedia.dtos.WmChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/3/16 10:49
 * @Version 1.0
 */
@RestController
@RequestMapping()
@RequiredArgsConstructor
public class AdminChannelController {

    private final IWmChannelClient wmChannelClient;

    @ApiOperation("根据id删除频道")
    @LogModule(value = "根据id删除频道")
    @GetMapping("/api/v1/channel/del/{id}")
    ResponseResult delById(@PathVariable Integer id){
        return wmChannelClient.delById(id);
    };

    @ApiOperation("频道名称模糊分页查询")
    @PostMapping("/api/v1/channel/list")
    ResponseResult listPage(@RequestBody WmChannelDto wmChannel){
        return wmChannelClient.listPage(wmChannel);
    };

    @ApiOperation("保存频道")
    @LogModule(value = "保存频道")
    @PostMapping("/api/v1/channel/save")
    ResponseResult saveChannel(@RequestBody WmChannel wmChannel){
        return wmChannelClient.saveChannel(wmChannel);
    };

    @ApiOperation("修改频道")
    @LogModule(value = "修改频道")
    @PostMapping("/api/v1/channel/update")
    ResponseResult updateChannel(@RequestBody WmChannel wmChannel){
        return wmChannelClient.updateChannel(wmChannel);
    };

}